package c1762;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.*;

public class B {
    static Scanner cin = new Scanner(new BufferedInputStream(System.in));//大量输入优化版本
    static PrintWriter cout = new PrintWriter(new BufferedOutputStream(System.out));//大量输出优化版本
    static PrintWriter cerr = new PrintWriter(System.err, true);//开启调试模式,一般输出量不大，不需要buffered

    public static void main(String[] args) {
        //TODO AOJ开启你的ACM传奇人生
        Map<String, Integer> map = new TreeMap<>();
        int size = 0;
        while (cin.hasNext()) {
            String word = cin.next();
            ++size;
            if (map.containsKey(word)) {
                map.put(word, map.get(word) + 1);
            } else {
                map.put(word, 1);
            }
        }
        cout.println(size);
        for (String word : map.keySet()) {
            cout.println(word + ":" + map.get(word));
        }
        cin.close();//关闭输入流
        cout.close();//关闭输出流，这是必须的，否则一般不会自动刷新缓冲区
    }
}